
import 'dart:convert';

import 'package:flutter/services.dart';
import 'package:massagist/models/acctravel_model_entity.dart';
import 'package:massagist/models/massage_model_entity.dart';
import 'package:massagist/models/path_model_entity.dart';

class FileManager {
  static Future<String> readPrivacy() async {
    String content = await rootBundle.loadString('assets/txts/privacy.txt');
    return content;
  }

  static Future<List<AcctravelModelEntity>> readAcctravel() async {
    String content = await rootBundle.loadString('assets/configs/acctravel_info.json');
    List<dynamic> jsonList = json.decode(content);
    return jsonList.map((json) => AcctravelModelEntity.fromJson(json)).toList();
  }

  static Future<List<MassageModelEntity>> readMassage() async {
    String content = await rootBundle.loadString('assets/configs/massage_info.json');
    List<dynamic> jsonList = json.decode(content);
    return jsonList.map((json) => MassageModelEntity.fromJson(json)).toList();
  }

  static Future<List<PathModelEntity>> readPaths() async {
    String content = await rootBundle.loadString('assets/configs/path_info.json');
    List<dynamic> jsonList = json.decode(content);
    return jsonList.map((json) => PathModelEntity.fromJson(json)).toList();
  }
}